<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台用户管理</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__css/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min.css" rel="stylesheet">
    <link href="__ADMIN__css/animate.css" rel="stylesheet">
    <link href="__ADMIN__css/style.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/default/layer.css" rel="stylesheet">
    <link rel="stylesheet" href="__ADMIN__css/plugins/switchery/switchery.css" />
</head>
<body>
<div class="col-sm-12">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
         <h5>添加广告</h5>
        </div>
        <div class="ibox-content">
            <form method="post" enctype="multipart/form-data" action="{:U('poster/save')}" id="forma" name="forma" class="form-horizontal">
                <input type="hidden" name="id" id="id" value="{$list.id}">
                <input type="hidden" name="spaceid" id="spaceid" value="{$list.spaceid}">
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">广告标题</label>
                    <div class="col-sm-10">
                        <input type="text" name="title" value="{$list.name}" id="title" placeholder="请输入广告标题" class="form-control">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">所属版位</label>
                    <div class="col-sm-10">
                        <span class="form-control" style="color:red;"> {$list.spacename}</span>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">上线时间</label>

                    <div class="col-sm-10">
                        <input class="Wdate" value="{$list.startdate|date='Y-m-d H:i:s',###}" name="startdate" id="startdate" type="text" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'2008-03-08 11:30:00'})" >
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">下线时间</label>

                    <div class="col-sm-10">
                        <input class="Wdate" value="{$list.enddate|date='Y-m-d H:i:s',###}" name="enddate" id="enddate" type="text" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'2008-03-08 11:30:00'})" >
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">代码内容</label>

                    <div class="col-sm-10">
                        <script id="container" name="setting" type="text/plain">{$list.setting|htmlspecialchars_decode}</script>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>

                    <div class="col-sm-10">
                        <input type="checkbox" name="status" id="status" value="1" <if condition="$list['disabled'] eq 1"> checked</if> class="js-switch"  />
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>
                    <div class="col-sm-10">
                        <input type="text" name="listorder" value="{$list.listorder}" id="listorder" placeholder="请输入广告标题" class="form-control">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="col-sm-4 col-sm-offset-2">
                    <button class="btn btn-primary" type="submit">保存内容</button>
                    <button class="btn btn-white" type="reset" onclick="history.go(-1)">取消</button>
                </div>
            </form>

        </div>
    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.js"></script>
<script src="__ADMIN__js/plugins/switchery/switchery.js"></script>
<script src="__ADMIN__js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ADMIN__js/plugins/validate/messages_zh.min.js"></script>
<script src="__ADMIN__js/comment.js"></script>
<script type="text/javascript" src="__ADMIN__uedit/ueditor.config.js"></script>
<script type="text/javascript" src="__ADMIN__uedit/ueditor.all.js"></script>
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>
</body>
<script>
    $(function(){
        $("#forma").validate({
            rules:{
                title:"required"
            },
            message:{
                title:'广告标题不能为空'
            },
            submitHandler:function(form){
                //没有上传图片时可以用下面这种方法，如果上传图片就要使用FormData这种方法了
                /*var objnames = $(form).serializeArray();
                var datanames = new Object();
                $.each(objnames,function(key,val){
                   datanames[val.name] = val.value;
                });*/
                var forma = new FormData(document.getElementById('forma'));//这个方法在有上传图片这一项时用，否则用上面的方法
                $.ajax({
                    url:$(form).attr('action'),//获取到form表单action的值
                    type:'post',
                    dataType:'json',
                    data:forma,//此项使用第一种方法时，值为datanames，使用第二种方法时，值为adminform
                    cache: false,
                    processData: false,  // 告诉jQuery不要去处理发送的数据
                    contentType: false,   // 告诉jQuery不要去设置Content-Type请求头
                    success:function(data){
                        console.log(data.status);
                        if(data.status > 0){
                            comment.error(data.msg);
                        }else{
                            comment.success(data.msg,'{:U('posterspace/index')}');
                        }
                    }
                });
            }
        });
    });
    var elem = document.querySelector('.js-switch');
    var switchery = new Switchery(elem, { });
</script>
</html>
<script language="javascript" type="text/javascript" src="__ADMIN__js/plugins/My97/WdatePicker.js"></script>
